QT       += core gui

QT += quick # 如果不用，则移除

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

INCLUDEPATH += $$PWD/log/spdlog/include

DEFINES += APP_DEBUG_MODE

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

TRANSLATIONS = $$PWD/translator/lang_English.ts \
               $$PWD/translator/lang_Chinese.ts
win32: {

    # release下可调试
    QMAKE_LFLAGS_RELEASE+=/MAP
    QMAKE_CFLAGS_RELEASE += /Zi
    QMAKE_CXXFLAGS_RELEASE += /Zi
    QMAKE_LFLAGS_RELEASE +=/debug /opt:ref


    INCLUDEPATH += $$PWD/libs/crashpad/win/include
    INCLUDEPATH += $$PWD/libs/crashpad/win/include/mini_chromium

    LIBS += -lAdvapi32
    CONFIG(release,debug|release): {
        LIBS += -L$$PWD/libs/crashpad/win/lib/release -lbase -lclient -lutil
    }

    CONFIG(debug,debug|release): {
        LIBS += -L$$PWD/libs/crashpad/win/lib/debug -lbase -lclient -lutil
    }

    INCLUDEPATH += $$PWD/libs/mqtt/include
    LIBS += -L$$PWD/libs/mqtt/lib -lmosquitto -lmosquittopp
    CONFIG(debug,debug|release): {
        QMAKE_POST_LINK += xcopy $$system_path($$PWD/libs/mqtt/bin/*.dll) $$system_path($$OUT_PWD/debug) /y &
        QMAKE_POST_LINK += xcopy $$system_path($$PWD/translator/*.qm) $$system_path($$OUT_PWD/debug) /y &
        QMAKE_POST_LINK += xcopy $$system_path($$PWD/libs/crashpad/win/bin/*.exe) $$system_path($$OUT_PWD/debug) /y &
    }

    CONFIG(release,debug|release): {
        QMAKE_POST_LINK += xcopy $$system_path($$PWD/libs/mqtt/bin/*.dll) $$system_path($$OUT_PWD/release) /y &
        QMAKE_POST_LINK += xcopy $$system_path($$PWD/translator/*.qm) $$system_path($$OUT_PWD/release) /y &
        QMAKE_POST_LINK += xcopy $$system_path($$PWD/libs/crashpad/win/bin/*.exe) $$system_path($$OUT_PWD/release) /y &
    }

}

macx: {
    INCLUDEPATH += $$PWD/libs/crashpad/mac/include
    INCLUDEPATH += $$PWD/libs/crashpad/mac/include/mini_chromium

    LIBS += -framework Foundation \
            -framework CoreFoundation \
            -framework CoreGraphics \
            -framework CoreText \
            -framework Security \
            -lbsm

    CONFIG(release,debug|release): {
        LIBS += -L$$PWD/libs/crashpad/mac/lib -lbase -lclient -lutil
    }

    CONFIG(debug,debug|release): {
        LIBS += -L$$PWD/libs/crashpad/mac/lib -lbase -lclient -lutil
    }

    # mac brew install mqtt
    INCLUDEPATH += /usr/local/Cellar/mosquitto/1.5.4/include
    LIBS += -L/usr/local/Cellar/mosquitto/1.5.4/lib -lmosquitto -lmosquittopp

    QMAKE_POST_LINK += cp $$system_path($$PWD/translator/*.qm) $$system_path($$OUT_PWD/$${TARGET}.app/Contents/MacOS)
}

SOURCES += \
    Application.cpp \
    common/HashList.cpp \
    helper/ConfigHelper.cpp \
    helper/DirHelper.cpp \
    log/TSpdlog.cpp \
    log/TSpdlogAssistant.cpp \
    main.cpp \
    net/MqttCommon.cpp \
    net/MqttWrapper.cpp \
    ui_widget/widget.cpp

HEADERS += \
    Application.h \
    common/HashList.h \
    common/QStringExt.h \
    common/QtAppMacro.h \
    common/SingletonClass.h \
    helper/ConfigHelper.h \
    helper/DirHelper.h \
    log/TSpdlog.h \
    log/TSpdlogAssistant.h \
    net/MqttCommon.h \
    net/MqttWrapper.h \
    ui_widget/widget.h

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

DISTFILES +=

RESOURCES += \
    qml.qrc
